package Gui;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.InputStream;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;

import controller.CatalogControl;
import controller.ProductControl;

import Entity.Catalog;
import javax.swing.JComboBox;



// TODO: Auto-generated Javadoc
/**
 * The Class SearchCatalogProduct.
 */
public class SearchCatalogProduct extends JPanel{
	
	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = -6400283674228776823L;
	
	/** The Product id label. */
	public static JLabel ProductIDLabel;
	
	/** The Product sector label. */
	public static JLabel ProductSectorLabel;
	
	/** The Product type label. */
	public static JLabel ProductTypeLabel;
	
	/** The Order label. */
	public static JLabel OrderLabel;
//	public static JTextField ProductIDTextField = null;
	/** The Product name text field. */
public static JTextField ProductNameTextField=null;
	
	/** The Product color text field. */
	public static JTextField ProductColorTextField = null;
	
	/** The Product size text field. */
	public static JTextField ProductSizeTextField = null;
	
	/** The Product use text field. */
	public static JTextField ProductUseTextField = null;
	
	/** The Product price text field. */
	public static JTextField ProductPriceTextField = null;
	
	/** The Product picture text field. */
	public static JTextField ProductPictureTextField = null;
	
	/** The displaypid2button. */
	public static JButton displaypid2button;
	
	/** The fc. */
	public static  JFileChooser fc;
	
	/** The Openbutton. */
	public static JButton Openbutton;
	
	/** The confirmation lable. */
	public static JLabel confirmationLable=null;
	
	/** The confirmation lable2. */
	public static JLabel confirmationLable2=null;
	
	/** The confirmation lable3. */
	public static JLabel confirmationLable3=null;
	
	/** The picture. */
	public static JLabel picture=null;
	
	/** The back button. */
	public static JButton backButton = new JButton("Back");
	
	/** The s. */
	public String s=null;
	
	/** The Ecatalog. */
	private Catalog Ecatalog;
	
	/** The Ccatalog. */
	private CatalogControl Ccatalog;
	
	/** The pc. */
	private ProductControl pc;
	
	/** The Display button. */
	public static JButton DisplayButton;
	
	/** The Display2 button. */
	public static JButton Display2Button;
	
	/** The text area. */
	public static JTextArea textArea;
	
	/** The combo box. */
	private JComboBox<?> comboBox = null;
	
	/** The combo box_1. */
	private JComboBox<?> comboBox_1 = null;

;
	
	/**
	 * Instantiates a new search catalog product.
	 */
	public SearchCatalogProduct()
	{
		super();
		SearchProduct();
	}

	/**
	 * Search product.
	 */
	public void SearchProduct(){
		this.setSize( 1500,765 ); //set Frame size
		this.setLayout(null); //set layout
		OrderLabel = new JLabel();     //set new label
		OrderLabel.setBounds(new Rectangle(79, 122, 283, 19));//set label's  size and location
		OrderLabel.setText("Please insert product details:");
		OrderLabel.setFont(new Font("Arial", Font.ITALIC,16)); //set label font and size
		ProductSectorLabel = new JLabel();     //set new label
		ProductSectorLabel.setBounds(new Rectangle(94, 199, 113, 19));//set label's  size and location
		ProductSectorLabel.setText("Product Sector:"); 
		ProductSectorLabel.setFont(new Font("Arial", Font.ITALIC,12)); //set label font and size
		ProductTypeLabel = new JLabel();     //set new label
		ProductTypeLabel.setBounds(new Rectangle(94, 229, 113, 18));//set label's  size and location
		ProductTypeLabel.setText("Product Type:");  
		ProductTypeLabel.setFont(new Font("Arial", Font.ITALIC,12));
		
		this.add(ProductSectorLabel, null);   //add label to the panel
		this.add(ProductTypeLabel, null);
		this.add(OrderLabel, null);
		backButton.setBounds(245, 293, 150, 23);   //set button's size and location
		add(backButton);          // add button to the panel
		
		final JComboBox<String> comboBox = new JComboBox<String>();
		comboBox.setBounds(217, 199, 127, 20);
		comboBox.addItem("Kitchen");
		comboBox.addItem("crockery");
		comboBox.addItem("Picnic");
		comboBox.getSelectedItem();
		add(comboBox);
		
		final JComboBox<String> comboBox_1 = new JComboBox<String>();
		comboBox_1.setBounds(217, 229, 127, 20);
		comboBox_1.addItem("Cutlery");
		comboBox_1.addItem("Disposable Cutlery");
		add(comboBox_1);

		displaypid2button = new JButton("Display");              
		displaypid2button.addActionListener(new ActionListener() {
			@SuppressWarnings("deprecation")
			public void actionPerformed(ActionEvent arg0) {
				pc=new ProductControl();
				pc.ShowProductsBySectorAndType((String)comboBox.getSelectedItem(),(String)comboBox_1.getSelectedItem());
			
			}
		});
		
		displaypid2button.setBounds(79, 293, 150, 23);      //set button size
		add(displaypid2button);
		
		confirmationLable = new JLabel("");           // set result label
		confirmationLable.setBounds(472, 635, 350, 67);  // set label's size and location
		add(confirmationLable);
		confirmationLable.setVisible(false); 
		
		textArea = new JTextArea();
		textArea.setBackground(Color.LIGHT_GRAY);
		textArea.setEditable(false);
		textArea.setBounds(761, 174, 162, 253);
		add(textArea);
		
		
		


			
		}
	}
